package org.example;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author liyuehui
 * @time 2024/6/3 19:53
 */
public class Test {
    public static void main(String[] args) {
        Ticket t = new Ticket();
        ExecutorService es = Executors.newFixedThreadPool(5);
        do {
            es.execute(() -> t.sale());
        } while (t.getNum() > 0);
        es.shutdown();
    }
}
